package com.hzdesk.media.matvector.koreabatch.client.my_paperless.fragment.Fragment_view;


import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.R;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.bean.DevicesManagerBean;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.custom_view.MyRecyclerView;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.fragment.BaseFragment;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.fragment.Fragment_persenter.DevicesManagerPersenter;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.fragment.fragment_contract.IDevicesManagerContract;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.view.DevicesManagerPagerActivity;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.view.DevicesUndeMettingPagerActivity;


/**
 * Created by Administrator on 2018/8/8.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 * <p>
 * <p>
 * 设备 碎片
 */

public class DevicesManagerFragment extends BaseFragment implements IDevicesManagerContract.IDevicesManagerView {



    ImageView ivPromptEmptyView;
    private DevicesManagerPersenter mDevicesManagerPersenter = new DevicesManagerPersenter(this);
    private MyRecyclerView fragmentDevicesManagerMyRecylerview_02;
    private RelativeLayout rl;


    @Override
    protected void cancellationControls() {
        if(ivPromptEmptyView != null){
            ivPromptEmptyView =null;
        }
        if(fragmentDevicesManagerMyRecylerview_02 != null){
            fragmentDevicesManagerMyRecylerview_02 = null;
        }
    }

    @Override
    protected void initDate() {
        mDevicesManagerPersenter.iniTitle();
        //TODO  初始化MyRecyclerView数据
        mDevicesManagerPersenter.initMyRecyclerView(mContext,fragmentDevicesManagerMyRecylerview_02);
        mDevicesManagerPersenter.loadRecyclerViewDate(mContext);
    }

    @Override
    protected View getChildFragmentView() {
        View view = View.inflate(mContext, R.layout.fragment_devices_manager, null);
        ivPromptEmptyView = (ImageView) view.findViewById(R.id.iv_prompt_empty_view);
        rl = (RelativeLayout) view.findViewById(R.id.my_recyclerview_empty_rl);
       fragmentDevicesManagerMyRecylerview_02 = (MyRecyclerView) view.findViewById(R.id.fragment_devices_manager_my_recylerview_02);
        return view;
    }

    @Override
    public void onStart() {
        super.onStart();
        ivPromptEmptyView.setImageResource(R.mipmap.error_view);
        fragmentDevicesManagerMyRecylerview_02.setEmptyView(rl);
    }

    @Override
    protected void onClickedTvRight() {

    }

    @Override
    protected void onClickedIvRight() {

    }

    @Override
    protected void onClickedIvLeft() {

    }



    @Override
    public void settingTitle() {
        showTileTitleRlBg();
        showTilteBg();
        showTitleContent();
        //设备管理(6)
        setTitleContent("设备管理(6)", 0xffffffff);
    }

    @Override
    public void toDevicesManagerPager(DevicesManagerBean bean) {
        Intent intent = new Intent(mContext,DevicesManagerPagerActivity.class);
        intent.putExtra("device_attrib", bean);
        startActivity(intent);
    }



    @Override
    public void toDevicesUndeMettingPager(String id ) {
        Intent intent = new Intent(mContext,DevicesUndeMettingPagerActivity.class);
        intent.putExtra("devices_unde_metting_list",id);
        startActivity(intent);
    }
}
